﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace xushengqian.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class PhotoController : ControllerBase
    {
        [HttpPost]
        public IActionResult Photo(IFormFile file)
        {
            var p =Directory.GetCurrentDirectory()+@"/wwwroot/Pic/"+file.FileName;
            using(FileStream fs = new FileStream(p,FileMode.Create))
            {
                file.CopyTo(fs);
                fs.Flush();
            }
            return Ok("https://localhost:7113/Pic/" + file.FileName);
        }
    }
}
